# @Filename:    Test
# @Author:      王佳伟
# @Time:        2025-03-03 14:04
# @Describe:    测试代码
import unittest
from StudentManager import StudentManager
from Student import Student


class TestStudentManager(unittest.TestCase):

    def setUp(self):
        self.manager = StudentManager()

    def test_add_student(self):
        student = Student("Alice", 20, "Sophomore")
        self.manager.add_student(student)
        self.assertIn(student, self.manager.students)

    def test_delete_student(self):
        student = Student("Bob", 22, "Junior")
        self.manager.add_student(student)
        self.manager.delete_student("Bob")
        self.assertNotIn(student, self.manager.students)

    def test_find_student(self):
        student = Student("Charlie", 21, "Senior")
        self.manager.add_student(student)
        found_student = self.manager.find_student("Charlie")
        self.assertEqual(found_student, student)


if __name__ == '__main__':
    unittest.main()
